import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * Description: 一组各不相同的正整数，统计有多少正整数等于另外两个不同的正整数之和
 */
public class Test {
    public static void main(String[] args) {
        // 1.获取数据
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        // 2. 求和
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                set.add(nums[i] + nums[j]);
            }
        }
        // 2. 查找统计
        int count = 0;
        for (int i = 0; i < n; i++) {
            if(set.contains(nums[i])) {
               count++;
            }
        }
        System.out.println(count);
    }
}
